<?php

namespace App\Validate\api;

use Illuminate\Foundation\Http\FormRequest;
use App\Validate\BaseValidate;

class ChapterValidate extends BaseValidate
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'=>'required',
            'cid'=>'required|integer',
            'id'=>'required|integer',
            'location'=>'required|integer',
            'exchange_id'=>'required|integer',
            'pic_uri'=>'required'
        ];
    }

    public function messages()
    {
        return [
            'title.required'=>'标题不能为空',
            'cid.integer'=>'项目ID必须为整数',
            'id.integer'=>'原章节ID必须为整数',
            'pid.integer'=>'图片ID必须为整数',
            'location.integer'=>'location必须为整数',
            'exchange_id.integer'=>'待交换ID必须为整数',
            'matter_list.required'=>'图片信息列表不能为空',
            'pic_uri.required'=>'图片不能为空',
        ];
    }

    public $scenes = [
        'chapter'=>['title','cid'],
        'sort'=>['id','exchange_id'],
        'list'=>['cid'],
        'del'=>['id'],
        'picInfo'=>['pid'],
        'savePic'=>['id','pic_uri','location','matter_list'],
        'move'=>['id','exchange_id','location'],
        'picEdit'=>['pid','matter_list','pic_uri']
    ];
}
